/**
 * @Title:UserManageBusinessServiceImpl.java
 * @Package com.cnooc.business.common.impl
 * @Description TODO
 * @author Jiangcl
 * @date 2012-2-16下午01:24:48
 * @version V1.0
 */
package com.cat.business.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cat.business.UserManageBusinessService;
import com.cat.entity.TbUser;
import com.cat.service.common.UserService;

/**
 * @ClassName: UserManageBusinessServiceImpl
 * @Description: 人员管理
 * @author Jiangcl
 * @date 2012-2-16下午01:24:48
 * 
 */
@Service
public class UserManageBusinessServiceImpl implements UserManageBusinessService {

	@Resource
	private UserService userService;

	@Override
	public List<TbUser> getUserList() {
		return userService.getAll();
	}

	@Override
	public void saveUser(TbUser user) {
		if (user.getUserId() != null) {
			userService.update(user);
		} else {
			userService.save(user);
		}
	}

	@Override
	public TbUser getUser(Integer id) {
		TbUser model = new TbUser();
		model = userService.get(id);
		if (model == null) {
			return null;
		}
		return model;
	}

	@Override
	public void deleteUser(TbUser user) {
		if (user.getUserId() != null) {
			userService.delete(user);
		}
	}
}
